package com.gtw;

import com.gtw.prototype.Prototype;

import java.io.IOException;

public class Client {

    public static void main(String[] args) throws CloneNotSupportedException, IOException, ClassNotFoundException {
        Prototype prototype = new Prototype();
        prototype.setName("张三");
        prototype.setList("姓名");
        System.out.println("name:" + prototype.getName() + "----" + "list:" + prototype.getList());

        Prototype copyPrototype = prototype.clone();
        copyPrototype.setName("李四");
        copyPrototype.setList("性别");
        System.out.println("name:" + prototype.getName() + "----" + "list:" + prototype.getList());
        System.out.println("name:" + copyPrototype.getName() + "----" + "list:" + copyPrototype.getList());

        Prototype deepCopy = (Prototype) prototype.deepClone();
        deepCopy.setName("王五");
        deepCopy.setList("年龄");
        System.out.println("name:" + prototype.getName() + "----" + "list:" + prototype.getList());
        System.out.println("name:" + deepCopy.getName() + "----" + "list:" + deepCopy.getList());
    }
}
